<%@ page import="java.util.List" %>
<%@ page import="cn.com.entity.Comment" %>
<%@ page import="cn.com.controler.Comment.CommentDAO" %>
<%--
  Created by IntelliJ IDEA.
  User: DELL
  Date: 2020/10/9
  Time: 22:59
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>我的评论</title>
    <style>
        article{
            width: 800px;
            margin: 0 auto;
        }
        section{
            width: 100%;
            padding: 20px;
            box-sizing: border-box;
            border: 2px solid#1682c2;
            margin-bottom: 30px;
        }
        .itime,.plwho{
            width: 300px;
            height: 30px;
            line-height: 30px;
            text-align: center;
            margin: 0 20px;
            float: left;

        }
        .cont{
            display: inline-block;
            line-height: 30px;
            text-indent: 30px;
            margin-top: 10px;
        }
    </style>
</head>
<body>
<article>
    <%
        CommentDAO commentDAO = new CommentDAO();
        request.setCharacterEncoding("utf-8");
        List usercomment = (List)session.getAttribute("usercomment");
        if(usercomment.size() !=0){
            for (int i = 0; i < usercomment.size(); i++) {
                Comment comment = (Comment)usercomment.get(i);
                Integer commentArtId = comment.getCommentArtId();
                //获取评论对象姓名
                String getdxname = commentDAO.getdxname(commentArtId);
    %>
    <section>
        <div class="itime">
            <%=comment.getCommentTime()%>
        </div>
        <div class="plwho">
            ${sessionScope.user.username}&nbsp;&nbsp;&nbsp;评价&nbsp;<%=getdxname%>
        </div>
        <div class="cont">
            <%=comment.getCommentContent()%>
        </div>
    </section>
    <%
        }
        }else{
    %>
    <section>
        <div class="itime">
            还没有评论，快去评论吧！
        </div>
        <div class="plwho">

        </div>
        <div class="cont">

        </div>
    </section>
    <%
        }
    %>

</article>
</body>
</html>
